<template>
  <div class="app-container home">
    <h2>首页开发中，尽情期待！</h2>
    <!-- 嵌入聊天机器人 -->
    <div id="dify-chatbot"></div>
  </div>
</template>

<script setup name="Index">
import {ref, onMounted} from 'vue';

const version = ref('3.8.8');

function goTarget(url) {
  window.open(url, '__blank');
}

function loadChatbot() {
  const script = document.createElement('script');
  script.src = "http://127.0.0.1/embed.min.js";
  script.id = "hMDVDRH9QfQFW1U6";
  script.defer = true;
  document.body.appendChild(script);

  window.difyChatbotConfig = {
    token: 'hMDVDRH9QfQFW1U6',
    baseUrl: 'http://127.0.0.1'
  };
}

onMounted(() => {
  loadChatbot();
});
</script>

<style scoped lang="scss">
.home {
  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  h2 {
    width: 320px;
    margin: auto;
    font-size: 26px;
    font-weight: 100;
  }
}

/* 自定义聊天机器人样式 */
#dify-chatbot-bubble-button {
  background-color: #1C64F2 !important;
}

#dify-chatbot-bubble-window {
  width: 24rem !important;
  height: 40rem !important;
}
</style>
